<?php
/**
 * Created by 项目.
 * User: xuguopeng
 * Date: 7/14/21
 * Time: 11:06 PM
 */

namespace app\api\controller\v1;


use app\api\controller\BaseController;
use app\api\model\SjActivity as SjActivityModel;
use app\api\service\activity_order\CreateSjOrder;

class SjActivity extends BaseController
{
    protected $beforeActionList = [
        'checkExclusiveScope' => ['only' => 'getDataInfo']
    ];

    /**
     * 获取商家活动详情
     */
    public function getDataInfo($id)
    {
        return SjActivityModel::where('id',$id)->with('imgs.img,items')->find();
    }


    /**
     * 创建商家订单
     */
    public function createData($id, $week, $sjActivityItemId,$number,$date,$type)
    {
        $order = new CreateSjOrder($id, $week, $sjActivityItemId,$number,$date,$type);
        return $order->entrance();
    }

}